package com.songcha.module_mine.ui.fragment.message.message_notify

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.songcha.library_base.mvvm.base.BaseMvvmFragment
import com.songcha.library_common.util.ToastUtil
import com.songcha.module_mine.R
import com.songcha.module_mine.bean.SystemMessageDataBean
import com.songcha.module_mine.databinding.MineFragmentMessageNotifyBinding
import com.songcha.module_mine.ui.adapter.MessageNotifyAdapter

class MessageNotifyFragment:BaseMvvmFragment<MessageNotifyViewModel,MineFragmentMessageNotifyBinding>() {
    private var mAdapter:MessageNotifyAdapter<MineFragmentMessageNotifyBinding>?=null

    override fun getLayoutId():Int{
        return R.layout.mine_fragment_message_notify
    }

    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)

        viewModel.getSystemMessage()

        viewModel.messageList.observe(this){data->
            initRcv(data)
        }

    }

    private fun initRcv(list:MutableList<SystemMessageDataBean.SystemMessageBean>){
        databinding.mineRcvMessageNotify.apply {
            layoutManager=LinearLayoutManager(context)
            mAdapter=MessageNotifyAdapter(list)
            adapter=mAdapter
        }
    }

}